﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class WebForm4 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bindrpPerson();
            }
        }


        private void bindrpPerson()
        {
            List<Person> personList = new List<Person>(){
                new Person(){ UserNum="20091041",UserName="张三", UserAge=20},
                new Person(){ UserNum="20091042",UserName="李四", UserAge=21},
                new Person(){ UserNum="20091043",UserName="王武", UserAge=22},
                new Person(){ UserNum="20091044",UserName="赵六", UserAge=23}
            };
            rpPerson.DataSource = personList;
            rpPerson.DataBind();

           //Repeater1.DataSource = personList;
           //Repeater1.DataBind();
        }

        protected void rpPerson_ItemCreated(object sender, RepeaterItemEventArgs e)
        {

        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            //  LinkButton1.Attributes.Add("onclick", string.Format("javascript:OpenEditWin('{0},500,400')","111"));
        }

        protected void rpPerson_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item)
            {

                //e.Item.Attributes.Add("onmouseover", "oldBG=this.style.backgroundColor; this.style.backgroundColor='#ff5599';");

                //e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=oldBG");
            }
        }

        protected void rpPerson_ItemCommand(object source, RepeaterCommandEventArgs e)
        {

        }

    }

    public class Person
    {
        public int UserAge { get; set; }
        public string UserName { get; set; }
        public string UserNum { get; set; }
        public Person() { }
        public Person(int UserAge, string UserName, string UserNum)
        {
            this.UserAge = UserAge;
            this.UserName = UserName;
            this.UserNum = UserNum;
        }
    }
}